home *** CD-ROM | disk | FTP | other *** search
- ------------- Listing 1: The file ostream ------------------
-
- // ostream standard header
- #ifndef _OSTREAM_
- #define _OSTREAM_
- #include <streambuf>
- // class ostream
- class ostream : virtual public ios {
- public:
- ostream(streambuf *_S)
- : ios(_S) {}
- ostream(_Uninitialized)
- : ios(_Noinit) {}
- virtual ~ostream();
- _Bool opfx();
- void osfx();
- ostream& operator<<(ostream& (*_F)(ostream&))
- {return ((*_F)(*this)); }
- ostream& operator<<(ios& (*_F)(ios&))
- {(*_F)(*(ios *)this); return (*this); }
- ostream& operator<<(const char *);
- ostream& operator<<(char _C)
- {put(_C); return (*this); }
- ostream& operator<<(unsigned char _C)
- {return (*this << (char)_C); }
- ostream& operator<<(short _X)
- {return (_Print(&"B hoB hxB hd"[_If()], _X)); }
- ostream& operator<<(unsigned short _X)
- {return (_Print(&"B hoB hxB hu"[_If()], _X)); }
- ostream& operator<<(int _X)
- {return (_Print(&"B oB xB d"[_If()], _X)); }
- ostream& operator<<(unsigned int _X)
- {return (_Print(&"B oB xB u"[_If()], _X)); }
- ostream& operator<<(long _X)
- {return (_Print(&"B loB lxB ld"[_If()], _X)); }
- ostream& operator<<(unsigned long _X)
- {return (_Print(&"B loB lxB lu"[_If()], _X)); }
- ostream& operator<<(float _X)
- {return (_Print(&"P. eP. fP. g"[_Ff()], _Pr(), _X)); }
- ostream& operator<<(double _X)
- {return (_Print(&"P.leP.lfP.lg"[_Ff()], _Pr(), _X)); }
- ostream& operator<<(long double _X)
- {return (_Print(&"P.LeP.LfP.Lg"[_Ff()], _Pr(), _X)); }
- ostream& operator<<(void *);
- ostream& operator<<(streambuf&);
- ostream& put(char);
- ostream& write(const char *, int);
- ostream& write(const unsigned char *_S, int _N)
- {return (write((const char *)_S, _N)); }
- ostream& flush();
- #if _HAS_SIGNED_CHAR
- ostream& operator<<(signed char _C)
- {return (*this << (char)_C); }
- ostream& write(const signed char *_S, int _N)
- {return (write((const char *)_S, _N)); }
- #endif /* _HAS_SIGNED_CHAR */
- protected:
- int _Ff()
- {return ((flags() & floatfield) == scientific ? 0
- : (flags() & floatfield) == fixed ? 4 : 8); }
- int _If()
- {return ((flags() & basefield) == oct ? 0
- : (flags() & basefield) == hex ? 4 : 8); }
- void _Pad(const char *, char *, int);
- int _Pr();
- ostream& _Print(const char *, ...);
- };
- // manipulators
- ostream& endl(ostream&);
- ostream& ends(ostream&);
- ostream& flush(ostream&);
- #endif
-
-